package edu.sctu.zhuyingzhi.month201504.day20150430.FatherToSun;

/**
 * Created by user13 on 2015/4/30.
 */
public class Main1 {
    public static void main(String[] args) {
        Sun1 sun1=new Sun1();
        Father1 father1=sun1;
       /* Father1 father1=new Father1();
        Sun1 sun1= (Sun1) father1;*/
        callF(father1);
        callF(new Sun1());

    }
    public static void callF(Father1 father) {
        if (father instanceof Sun1) {
            Sun1 sun1=(Sun1) father;
            sun1.func1();
            sun1.func2();
            sun1.func3();
        }
        else{
            father.func1();
            father.func2();
        }
    }
}
